/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package commons.httpclient;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import org.apache.http.entity.StringEntity;
import org.apache.http.util.EntityUtils;

/**
 *
 * @author Swang
 */
public class Entity {

    public static void main(String[] args) throws UnsupportedEncodingException, IOException {
        StringEntity myEntity = new StringEntity("important message",
                "UTF-8");
        System.out.println(myEntity.getContentType());
        System.out.println(myEntity.getContentLength());
        System.out.println(EntityUtils.getContentCharSet(myEntity));
        System.out.println(EntityUtils.toString(myEntity));
        System.out.println(EntityUtils.toByteArray(myEntity).length);
    }
}
